package com.wzw.springboot.principle.exception;

import com.wzw.springboot.principle.mvc.model.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 *
 * @author Wangzhiwen
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = BusinessException.class)
    public Result handleBusinessException(BusinessException e) {
        return Result.ofFail(400, e.getMessage(), e);
    }
}
